﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace Photography.Controls.Galleria
{
    public partial class GalleriaControl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // Used in case of classic
            /*HtmlGenericControl style = new HtmlGenericControl();
            style.TagName = "style";
            style.Attributes.Add("type", "text/css");
            style.InnerHtml = "#" + ClientID + "div{height:320px}";
            Page.Header.Controls.Add(style);*/

            Page.ClientScript.RegisterClientScriptInclude("JQuery", "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
            Page.ClientScript.RegisterClientScriptInclude("Galleria", ResolveUrl("galleria-1.2.6.min.js"));

            Page.ClientScript.RegisterStartupScript(this.GetType(), "Galleria_" + ClientID,
                "<script> Galleria.loadTheme('" + ResolveUrl("Styles/Fullscreen/galleria.fullscreen.min.js") + "'); $('#" + ClientID + "div').galleria({autoplay: 5000}); </script>");
        }

        public string DataSourceID
        {
            set { rptImages.DataSourceID = value; }
        }

        public string SourceField
        {
            get
            {
                object o = ViewState["SourceField"];
                return ((o == null) ? string.Empty : (string)o);
            }
            set
            {
                ViewState["SourceField"] = value;
            }
        }

        public string TitleField
        {
            get
            {
                object o = ViewState["TitleField"];
                return ((o == null) ? string.Empty : (string)o);
            }
            set
            {
                ViewState["TitleField"] = value;
            }
        }

        public string DescriptionField
        {
            get
            {
                object o = ViewState["DescriptionField"];
                return ((o == null) ? string.Empty : (string)o);
            }
            set
            {
                ViewState["DescriptionField"] = value;
            }
        }
    }
}